<?php

class FaxViewer {
  
  public $smarty = null;
  
  private $imagecache_url;
  
  public function __construct() {
    $this->smarty =& new FaxViewerSmarty;
    $this->imagecache_url = FaxConfig::getConfig()->getValue('imagecache_url');
  }
  
  private function drawFilmstrip() {
    
  }
  
  private function drawFax() {
    
  }
  
  private function drawThumbnails() {
    
  }
  
  public function drawLoading() {
    $this->smarty->display('loading.tpl');
  }
  
  public function drawUILibrary() {
    $this->smarty->display('library.tpl');
  }
  
  public function drawUINormal($id) {
    $this->smarty->assign('id', $id);
    // $this->smarty->assign('inbox', FaxManager::getInstance()->getInbox());
    // $this->smarty->assign('images_url', $this->imagecache_url.'inbox/thumbnails/');
    $this->smarty->display('normal.tpl');
  }
  
  public function handleViews($view, $id) {
    
    if ($view == "thumbnails") {
      $this->smarty->assign('inbox', FaxManager::getInstance()->getInbox());
      $this->smarty->assign('images_url', $this->imagecache_url.'recvq/thumbnails/');
      $this->smarty->display('thumbnails.tpl');
    }
    
    if ($view == "filmstripe") {
      $this->smarty->assign('inbox', FaxManager::getInstance()->getInbox());
      $this->smarty->assign('images_url', $this->imagecache_url.'recvq/thumbnails/');
      $this->smarty->display('filmstripe.tpl');
    }
    
    if ($view == "fax" and !empty($id)) {
      $info = FaxManager::getInstance()->getFax($id);
      
      $this->smarty->assign('id', $id);
      $this->smarty->assign('pages', $info[0]['pages']);
      $this->smarty->assign('images_url', $this->imagecache_url.'recvq/medium/');
      $this->smarty->display('fax.tpl');
    }
    
    if ($view == "header") {
      $this->smarty->display('header.tpl');
    }
    
    if ($view == "control" and !empty($id)) {
      $this->smarty->assign('id', $id);
      $this->smarty->assign('pdf_url', $this->imagecache_url.'recvq/pdf/');
      $this->smarty->display('control.tpl');
    }
    
    if ($view == "intro") {
      $this->smarty->display('intro.tpl');
    }
  }
  
  
}
?>